#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
#include<unordered_map>
using namespace std;


  struct ListNode {
     int val;
      ListNode *next;
      ListNode() : val(0), next(nullptr) {}
      ListNode(int x) : val(x), next(nullptr) {}
      ListNode(int x, ListNode *next) : val(x), next(next) {}
  };
class Solution {
public:
    ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
        int t = 0;
        ListNode* head = new ListNode();
        ListNode* tmp = head;
        while (l1 && l2)
        {
            int num = 0;
            num = l1->val + l2->val + t;
            t = num / 10;
            num = num % 10;
            ListNode* node = new ListNode(num);
            tmp->next = node;
            tmp = node;
            l1 = l1->next;
            l2 = l2->next;
        }
        while (l1)
        {
            int num = 0;
            num = l1->val + t;
            t = num / 10;
            num = num % 10;
            ListNode* node = new ListNode(num);
            tmp->next = node;
            tmp = node;
            l1 = l1->next;
        }
        while (l2)
        {
            int num = 0;
            num = l2->val + t;
            t = num / 10;
            num = num % 10;
            ListNode* node = new ListNode(num);
            tmp->next = node;
            tmp = node;
            l2 = l2->next;
        }
        while (t)
        {
            int num = t;
            t = num / 10;
            num = num % 10;
            ListNode* node = new ListNode(num);
            tmp->next = node;
            tmp = node;
        }
        return head->next;
    }
};

int main() {
    vector<int> arr = { -5,-5 };
    int ret = Solution().reversePairs(arr);
    return 0;
}